from django.db import models
from User.models import *
# Create your models here.
'''
       Information:资讯表
                title:标题
                content:内容
                date:日期
                types:分类ID
                users：用户ID
                power:查看权限
                state:审核状态
                filename:文件名
                isDelete:删除文章
                route:上传附件路径
'''
class Information(models.Model):
        title=models.CharField(max_length=100)
        content=models.CharField(max_length=2000)
        date=models.DateTimeField(auto_now=True)
        types=models.ForeignKey(to='Type',on_delete=models.CASCADE)
        users=models.IntegerField()
        #users=models.ForeignKey(User ,on_delete=models.CASCADE)
        power=models.IntegerField()
        state=models.IntegerField(default='2')
        filename=models.CharField(max_length=20)
        isDelete=models.BooleanField(default=False)
        route=models.FileField(upload_to='static/information',max_length=100)
        class Meta():
                db_table='Information'
'''
        Type:资讯分类表
                Typename:分类名字
'''
class Type(models.Model):
        typename=models.CharField(max_length=10)
        class Meta():
                db_table='Type'

